package homewoek12月19号.homwwork.h7;

import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.beanutils.ConvertUtils;
import org.apache.commons.beanutils.converters.DateConverter;

import java.util.Date;
import java.util.Map;

public class MyBeanUtils {
    public static void populate(Class c, Map<String,Object[]> map) throws Exception{
        DateConverter dateConverter = new DateConverter();
        dateConverter.setPatterns(new String[]{"yyyy-MM-dd"});
        ConvertUtils.register(dateConverter, Date.class);
        Object o = c.newInstance();
        BeanUtils.populate(o,map);
        System.out.println(o);
    }
}
